<extend name="Layout:ly2"/>

<block name="head">
    <style>
        #user_edit{
            margin-top: 10px;
        }
    </style>

    <script>
        $(document).ready(function () {
            var Table = $('table');
            var DataTable = Table.DataTable({
                language: dataTables_zh_CN,
                pageLength: 10
            });

            //删除信息
            $('body').delegate('table tr td .delete','click',function(){
                var id = $(this).parents('tr').data('id');
                layer.confirm('你确定要删除吗？', {
                    btn: ['确定','取消'], //按钮
                    shade: [0.4, '#393D49'] //显示遮罩
                }, function(){
                    $.get("{:U('Admin/Ask/question_answer_delete')}",{"id": id},function(msg){
                        if(msg == 1){
                            layer.msg("删除成功，1秒后自动关闭~~",{ico:1,time:1000},function(){
                                $('table tr#id_'+id).remove();
                            })
                        }else if(msg == 2){
                            layer.msg("参数异常，1秒后自动关闭~~",{ico:1,time:1000});
                        }else{
                            layer.msg("删除失败，1秒后自动关闭~~",{ico:1,time:1000});
                        }
                    })
                });
            })
        });
    </script>

</block>

<block name="body">
    <div id="page-wrapper" style="margin-left: 0">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">回复管理</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        回复列表
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-bordered table-hover table-responsive">
                                <thead>
                                <tr>
                                    <th>回复ID</th>
                                    <th>问答内容</th>
                                    <th>回复内容</th>
                                    <th>用户名</th>
                                    <th>回复时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                               <foreach name="data" item="v">
                                <tr id="id_{$v.id}" data-id="{$v.id}">
                                    <td>{$v.id}</td>
                                    <td>{$v.ask_content}</td>
                                    <td>{$v.content}</td>
                                    <td>{$v.mobile}</td>
                                    <td>{$v.addtime}</td>
                                    <td>
                                        <a class="btn btn-danger admin_user delete">删除</a>
                                    </td>
                                </tr>
                               </foreach>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
    </div>
    <!-- /#page-wrapper -->
</block>